<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>方剂在线</title>
<script type="text/javascript">	
	function simSch(){
	 var q=document.qForm.key.value;
	 if(q==''){
	   alert("请输入搜索词！");
	   }
	 else{
	   var cat;
	   for(var i=0;i<4;i++){
	      if(document.getElementsByName("tt")[i].checked==true){
	          cat=document.getElementsByName("tt")[i].value;
	       }
	   }
	   document.queryForm.q.value=cat+":"+q;
	   queryForm.submit();  
	   }
	}
	
	
	function comSch(){
	var display=document.getElementById("schBanner").style.display;
	if(display=='none'){
	    document.getElementById("schBanner").style.display='';
	   }
	else{
	   document.getElementById("schBanner").style.display='none';
	   }
	 document.getElementById('cb1').checked=false;
	 document.getElementById('cb2').checked=false;
	 document.getElementById('cb3').checked=false;
	 document.getElementById('cb4').checked=false;
	 document.getElementById('cb5').checked=false;
	 document.getElementById('fangmBanner').style.display='none';
	 document.getElementById('yaowzcBanner').style.display='none';
	 document.getElementById('zuzBanner').style.display='none';
	 document.getElementById('gongxBanner').style.display='none';
	 document.getElementById('chuflyBanner').style.display='none';
	 document.getElementById('schButton').style.display='none';
	}
	
	function makeSch(){
	var fangmtext=document.cqueryForm.fangmtext.value;
	var zuztext=document.cqueryForm.zuztext.value;
	var yaowzctext=document.cqueryForm.yaowzctext.value;
	var gongxtext=document.cqueryForm.gongxtext.value;
	var chuflytext=document.cqueryForm.chuflytext.value;
	var schString='';
	if(fangmtext!='')
	schString=schString+" fangm:"+fangmtext;
	if(zuztext!='')
	schString=schString+' zuz:'+zuztext;
		//alert(schString);
	if(yaowzctext!='')
	schString=schString+' yaowzc:'+yaowzctext;
		//alert(schString);
	if(gongxtext!='')
	schString=schString+' gongx:'+gongxtext;
		//alert(schString);
	if(chuflytext!='')
	schString=schString+' chufly:'+chuflytext;
	if(schString==''){
	   alert("请输入搜索词！");
	   }else{
	document.cqueryForm.q.value=schString;
	cqueryForm.submit();
	   }
	}
	   
	function showBanner(value){
	var display=document.getElementById(value).style.display;
	if(display=='none'){
	document.getElementById(value).style.display='';
	document.getElementById('schButton').style.display='';
	
	
	   }
	else
	document.getElementById(value).style.display='none';
	   
	var display1=document.getElementById('fangmBanner').style.display;
	var display2=document.getElementById('yaowzcBanner').style.display;
	var display3=document.getElementById('zuzBanner').style.display;
	var display4=document.getElementById('gongxBanner').style.display;
	var display5=document.getElementById('chuflyBanner').style.display;
	if(display1=='none'&&display2=='none'&&display3=='none'&&display4=='none'&&display5=='none')
	  document.getElementById('schButton').style.display='none';
    }
</script>
</head>

<body bgcolor="#ECECF4">
<br>
<br>
<br>
	<div align="center">
		<div align="center"><h1>方剂在线</h1></div>
	   <form name="qForm">
	   <input type="radio" name="tt" value='fangm' checked="true" />方剂名称
	      <input type="radio" name="tt" value='yaowzc' />药物
	      <input type="radio" name="tt" value='zuz' />主治
	      <input type="radio" name="tt" value='gongx' />功效<br><br>
	      请输入关键词：<input type="text" name="key" /><br/>
	      
	   </form>
  
		<form name="queryForm" method="get" action="<%=path %>/select/">
		  <input type="hidden" name="q" />
		  <input name="version" type="hidden" value="2.2" />
		  <input name="start" type="hidden" value="0" />
		  <input name="rows" type="hidden" value="10" />
		  <input name="wt" type="hidden" value="xslt" />
		  <input name="tr" type="hidden" value="searchresult.xsl" />
		  <input name="echoParams" type="hidden" value="ALL" />
		  <input type="button"  value="搜索" onClick="simSch();" />  &nbsp;<input type="button" value="高级检索" onClick="comSch();"></input>
		</form>
 <br/>
	   <br/>
		
		<div id="schBanner" style="display:none">
			请组合查询条件：
	      <input id="cb1"  type="checkbox" name="tt" value='fangm' onClick="showBanner('fangmBanner');"  />方剂名称
	      <input id="cb2"  type="checkbox" name="tt" value='yaowzc' onClick="showBanner('yaowzcBanner');"  />药物组成
	      <input id="cb3"  type="checkbox" name="tt" value='zuz' onClick="showBanner('zuzBanner');"  />主治
	      <input id="cb4"  type="checkbox" name="tt" value='gongx' onClick="showBanner('gongxBanner');" />功效
		  <input id="cb5"  type="checkbox" name="tt" value='chufly' onClick="showBanner('chuflyBanner');"  />处方来源
		</div>
        <form name="cqueryForm" method="get" action="<%=path %>/select/">
			<div id="fangmBanner" style="display:none">
           方剂名称：<input name="fangmtext" type="text" />&nbsp;
			</div>
			<div id="yaowzcBanner" style="display:none">
		  药物组成：<input name="yaowzctext" type="text" />&nbsp;
				</div>
			<div id="zuzBanner" style="display:none">
		   主    &nbsp;&nbsp;&nbsp;&nbsp;    治：<input name="zuztext" type="text" /><br/>
				</div>
			<div id="gongxBanner" style="display:none">
				功    &nbsp;&nbsp;&nbsp;&nbsp;    效：<input name="gongxtext" type="text" /><br/>
				</div>
			<div id="chuflyBanner" style="display:none">
				处方来源：<input name="chuflytext" type="text" /><br/>
				</div>
		  <input type="hidden" name="q" />
		  <input name="version" type="hidden" value="2.2"/>
		  <input name="start" type="hidden" value="0" />
		  <input name="rows" type="hidden" value="10" />
		  <input name="wt" type="hidden" value="xslt" />
		  <input name="echoParams" type="hidden" value="ALL" />
		  <input name="tr" type="hidden" value="fangji.xsl" /><br/>
			<div id="schButton" style="display:none">
		  <input type="button"  value="提交高级搜索" onClick="makeSch();" />
			  </div>
	     </form>
			  </div>
</body>
</html>